package com.smooth.dao.genx;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.smooth.dao.gen.bean.BaseCollege;

public interface GxCollegeMapper {
	@Select({"<script>",
			"select * from base_college where 1=1 ",
			"<if test='categoryId != null'> and category_id ='${categoryId}'</if>",
			"<if test='categoryId == null'> and category_id is null </if>",
			"<if test='provinceId != null'> and province_id ='${provinceId}'</if>",
			"<if test='levelEqual != null'> and level_equal ='${levelEqual}'</if>",
			"</script>"
	})
	public List<BaseCollege> queryCollege(@Param("provinceId") String provinceId ,@Param("categoryId") String categoryId,@Param("levelEqual") String levelEqual);
	
	@Select({"<script>",
		"select  category_id,category_name from base_college where 1=1 ",
		"<if test='categoryId != null'> and category_id ='${categoryId}'</if>",
		"<if test='provinceId != null'> and province_id ='${provinceId}'</if>",
		"<if test='levelEqual != null'> and level_equal ='${levelEqual}'</if>",
		" GROUP BY  category_id,category_name order by category_id desc ",
		"</script>"
	})
	public List<BaseCollege> queryRootCollegeProvinces(@Param("provinceId") String provinceId ,@Param("categoryId") String categoryId,@Param("levelEqual") String levelEqual);
	
	
	@Select({"<script>",
		"select * from base_college where 1=1 ",
		"<if test='collegeName != null'> and college_name like '%${collegeName}%'</if>",
		"<if test='provinceId != null'> and province_id ='${provinceId}'</if>",
		"<if test='queryStr != null'> and (college_name like '%${queryStr}%' or province_name like '%${queryStr}%')</if>",
		"</script>"
	})
	public List<BaseCollege> queryCollegeByStr(@Param("provinceId") String provinceId ,@Param("collegeName") String collegeName,@Param("queryStr") String queryStr);

	
}
